import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/components/community_cell/community_cell.dart';
import 'package:pornhub_app/components/text_view.dart';
import 'package:pornhub_app/routes/routes.dart';
import 'package:pornhub_app/utils/color.dart';
import 'package:pornhub_app/utils/logger.dart';
import 'package:pornhub_app/views/player/views/comment_list.dart';
// import 'package:pornhub_app/views/community/community_item_view.dart';

import 'post_details_page_controller.dart';

///帖子详情
class PostDetailsPage extends GetView<PostDetailsPageController> {
  const PostDetailsPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("帖子详情"),
      ),
      body: _bodyView(),
    );
  }

  _bodyView() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Obx(() => CommunityCell(
              model: controller.dynamicModel.value,
              isDetail: true,
              imageOnTap: (images, index) =>
                  Get.toImageViewer(images, currentIndex: index),
            )),
        Obx(() => TextView(
              text: "全部评论(${controller.dynamicModel.value.commentNum ?? 0})",
              fontSize: 16.w,
              color: COLOR.white,
            )).paddingSymmetric(horizontal: 14.w),
        Expanded(
          child: PlayCommentList(
            dynamicId: controller.dynamicId,
            type: CommentTypeEnumValue.circle,
          ),
        ),
      ],
    );
  }
}
